// 销售发票相关类型定义

/**
 * 发票明细项类型
 */
export interface InvoiceDetail {
  detailId?: number | null
  productName: string
  specification: string
  unit: string
  quantity: number
  unitPrice: number
  amount: number
  taxRate: number
  taxAmount: number
  subtotalAmount: number
  remarks: string
  isDelete?: boolean
}

/**
 * 销售发票基础类型
 */
export interface BaseSalesInvoice {
  invoiceNo: string
  orderId: number | null
  customerId: number | null
  invoiceAmount: number
  invoiceDate: string | Date
  invoiceType: string
  invoiceStatus: number
  taxRate: number
  taxAmount: number
  subtotalAmount: number
  remarks: string
  invoiceDetails: InvoiceDetail[]
}

/**
 * 销售发票表单类型（用于新增和编辑）
 */
export interface SalesInvoiceForm extends BaseSalesInvoice {
  invoiceId?: number
  createName?: string
  updateName?: string
}

/**
 * 发票列表项类型
 */
export interface InvoiceItem extends BaseSalesInvoice {
  invoiceId: number
  orderNo: string | null
  customerName: string
  invoiceStatusName: string
  createName: string
  createTime: string
  updateTime: string
  updateName: string | null
}

/**
 * 发票查询参数类型
 */
export interface InvoiceQueryParams {
  pageIndex: number
  pageSize: number
  invoiceNo?: string
  keyword?: string
  invoiceStatus?: number
  customerId?: number
  startDate?: string
  endDate?: string
}

/**
 * 发票列表API返回数据类型
 */
export interface InvoiceListResponse {
  code: number
  msg: string
  token: string | null
  data: {
    total: number
    totalCount: number
    data: InvoiceItem[]
  }
}

/**
 * 删除发票请求参数类型
 */
export interface DeleteInvoiceParams {
  invoiceId: number
  deleteName: string
}